﻿using System;
using System.Collections;

namespace HashTableTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("您以成功登入Steam!");

            Hashtable ht = new Hashtable();
            ht.Add(1, "Inside");
            ht.Add(2, "Counter-Strike");
            ht.Add(3, "Dota2");
            ht.Add(4, "PUBG");
            ht.Add(5, "LOL");
            Console.WriteLine("请输入你想查找的游戏名");
            int id = int.Parse(Console.ReadLine());
            bool flag = ht.ContainsKey(id);
            if (flag)
            {
                Console.WriteLine("您查找的游戏为:{0}", ht[id].ToString());
            }
            else
            {
                Console.WriteLine("没有该游戏哦~");
            }
            Console.WriteLine("所有游戏信息如下:");
            foreach(DictionaryEntry a in ht)
            {
                int key = (int)a.Key;
                string value = a.Value.ToString();
                Console.WriteLine("游戏编号:{0},游戏名:{1}",key,value);
            }
        }
    }
}
